unit FormConsultaGondolaUnit;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Bde.DBTables, Vcl.StdCtrls,
  Vcl.DBLookup, Vcl.Buttons, Vcl.Grids, Vcl.DBGrids, Datasnap.DBClient,U_FrmTemplateRel,
  Datasnap.Provider, RLReport;

type
  TFormConsultaGondola = class(TForm)
    TableCadastroGondola: TTable;
    TableCadastroGondolaID_GONDOLA: TStringField;
    TableCadastroGondolaNOME: TStringField;
    DataSourceCadastroGondola: TDataSource;
    DBGrid1: TDBGrid;
    Query1: TQuery;
    DataSource1: TDataSource;
    Query1ID_GONDOLA: TStringField;
    Query1NGONDOLA: TStringField;
    Query1ID_PRODUTO: TStringField;
    Query1NPRODUTO: TStringField;
    Query1EESTOATUAL: TFloatField;
    RLReport1: TRLReport;
    RLBand1: TRLBand;
    RLLabel1: TRLLabel;
    RLSystemInfo1: TRLSystemInfo;
    RLSystemInfo2: TRLSystemInfo;
    RLBand2: TRLBand;
    RLLabel2: TRLLabel;
    RLLabel3: TRLLabel;
    RLLabel4: TRLLabel;
    RLBand3: TRLBand;
    RLDBText1: TRLDBText;
    RLDBText2: TRLDBText;
    RLDBText3: TRLDBText;
    RLBand4: TRLBand;
    RLSystemInfo3: TRLSystemInfo;
    RLSystemInfo4: TRLSystemInfo;
    GroupBox1: TGroupBox;
    DBLookupCombo1: TDBLookupCombo;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    GroupBox2: TGroupBox;
    RadioButtonTudo: TRadioButton;
    RadioButtonMaior: TRadioButton;
    RadioButtonMenor: TRadioButton;
    RLSystemInfo5: TRLSystemInfo;
    RLDBText4: TRLDBText;
    Query1ECODBARRA: TStringField;
    RLLabel5: TRLLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  FormConsultaGondola: TFormConsultaGondola;

implementation

{$R *.dfm}

uses FormRelatorioUnit;


procedure TFormConsultaGondola.BitBtn1Click(Sender: TObject);
begin
  if RadioButtonTudo.Checked then
  begin
    Query1.SQL.Text := 'select gondola.*,estoque.* from gondola ' +
                       'left outer join estoque on gondola.id_produto = estoque.ecodigo '+
                       'where id_gondola like :id_gondola';
  end;
  if RadioButtonMaior.Checked then
  begin
    Query1.SQL.Text := 'select gondola.*,estoque.* from gondola ' +
                       'left outer join estoque on gondola.id_produto = estoque.ecodigo '+
                       'where id_gondola like :id_gondola and estoque.eestoatual > 0';
  end;
  if RadioButtonMenor.Checked then
  begin
    Query1.SQL.Text := 'select gondola.*,estoque.* from gondola ' +
                       'left outer join estoque on gondola.id_produto = estoque.ecodigo '+
                       'where id_gondola like :id_gondola and estoque.eestoatual <= 0 ';
  end;



  Query1.Close;
  Query1.Params[0].AsString := TableCadastroGondolaID_GONDOLA.AsString;
  Query1.Open;
end;

procedure TFormConsultaGondola.BitBtn2Click(Sender: TObject);

begin

   RLReport1.Preview();


end;

procedure TFormConsultaGondola.FormShow(Sender: TObject);
begin
Query1.Open;
end;



end.
